<template>
	<view>
		<view class="status_bar" :style="{height: statusMenuButton+'px'}"><!-- 这里是状态栏 -->
			<view class="jiaonang row a-center"
				:style="{marginTop:  statusHeight+'px', height: menuButtonHeight+'px'} ">

			</view>
		</view>
		<view :style="{marginTop: statusMenuButton+'px'}" style="background-color: #F6F6F6;">
			<view class="personInfo row j-sb">
				<view class="avatar row j-center a-center">
					<image style="width: 101px;height: 101px;border-radius: 48rpx" :src="user.myInfo.avatar"
						mode=""></image>
				</view>
				<view class="info row flex-column j-sa flex-1">
					<view class="name">
						{{user.myInfo.user_name}}
					</view>
					<view class="phone">
						{{user.myInfo.mobile}}
					</view>
				</view>
				<!-- <view class="more row a-center">
					<uni-icons type="forward" size="25" color="#88A9FE"></uni-icons>
				</view> -->
			</view>
			<view class="websiteInfo">
				<view class="infoWrap">
					<navigator url="/subpkg/feedback/feedback">
						<view class="infoItem row j-sb">
							<view class="infoIcon row j-center a-center">
								<image style="width: 38px;height: 38px;border-radius: 16rpx"
									src="../../static/user/icon1.png" mode=""></image>
							</view>
							<view class="infoName flex-1 row a-center">
								意见反馈
							</view>
							<view class="infoMore row a-center">
								<uni-icons type="forward" size="18" color="#AAACAA"></uni-icons>
							</view>
						</view>
					</navigator>
					<view class="infoItem row j-sb">
						<view class="infoIcon row j-center a-center">
							<image style="width: 38px;height: 38px;border-radius: 16rpx"
								src="../../static/user/icon2.png" mode=""></image>
						</view>
						<view class="infoName flex-1 row j-sa flex-column">
							<view class="">
								检查更新
							</view>
							<view class="value">
								V1.3.3
							</view>
						</view>
					</view>
					<view class="infoItem row j-sb">
						<view class="infoIcon row j-center a-center">
							<image style="width: 38px;height: 38px;border-radius: 16rpx"
								src="../../static/user/icon3.png" mode=""></image>
						</view>
						<view class="infoName flex-1 row j-sa flex-column">
							<view class="">
								客服电话
							</view>
							<view class="value">
								18362093272
							</view>
						</view>
					</view>
					<view class="infoItem row j-sb">
						<view class="infoIcon row j-center a-center">
							<image style="width: 38px;height: 38px;border-radius: 16rpx"
								src="../../static/user/icon4.png" mode=""></image>
						</view>
						<view class="infoName flex-1 row j-sa flex-column">
							<view class="">
								官方网站
							</view>
							<view class="value">
								http://zhxfcp.nz-cloud.com
							</view>
						</view>
					</view>
				</view>
				<view class="logout row j-center a-center" @click="logout">
					退出登录
				</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from 'vue'
	import { onReady } from '@dcloudio/uni-app'
	import { useStore } from '@/stores/user';
	const user = useStore()
	const statusHeight = ref<number>()
	const statusMenuButton = ref<number>()
	let menuButtonHeight = ref<number>()
	menuButtonHeight.value = uni.getMenuButtonBoundingClientRect().height + 7
	onReady(async () => {
		uni.getSystemInfo({
			success: (res) => {
				statusHeight.value = res.statusBarHeight
				statusMenuButton.value = statusHeight.value + menuButtonHeight.value
			}
		})
		// console.log(useStore);
	})
	const getInfo = () => {
		user.getMyInfo()
	}
	getInfo()
	const logout = () => {
		uni.showModal({
			title: '提示',
			content: '是否确定退出',
			success: (res) => {
				if (res.confirm) {
					console.log('用户点击确定');
					user.logout().then(() => {
						uni.reLaunch({
							url: '/pages/login/login'
						})
					})
				} else if (res.cancel) {
					console.log('用户点击取消');
				}
			}
		})
	}
</script>

<style scoped lang="scss">
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
		background: linear-gradient(269deg, #D6EFFF 0%, #DDE8FF 100%);
		position: fixed;
		overflow: hidden;
		top: 0;
	}

	.personInfo {
		height: 550rpx;
		background: linear-gradient(269deg, #D6EFFF 0%, #DDE8FF 100%);
		padding: 30rpx 60rpx;

		.avatar {
			width: 202rpx;
			height: 202rpx;
			border-radius: 48rpx;
		}

		.info {
			height: 202rpx;
			margin-left: 43rpx;
			color: #242424;
			font-weight: bold;

			.name {
				font-size: 32rpx;
			}

			.phone {
				font-size: 40rpx;
			}
		}

		.more {
			height: 202rpx;
		}
	}

	.websiteInfo {
		position: relative;
		top: -230rpx;
		padding: 0 24rpx;

		.infoWrap {
			height: 662rpx;
			background-color: #ffffff;
			box-shadow: 0px 3px 6px rgba(191, 191, 191, 0.16);
			border-radius: 16rpx;
			padding: 0 40rpx;
			margin-bottom: 20rpx;

			.infoItem {
				border-bottom: 1px solid #B3B4B3;
				padding: 34rpx 0;
				margin-bottom: 20rpx;

				.infoIcon {
					width: 76rpx;
					height: 76rpx;
					border-radius: 16rpx;
				}

				.infoName {
					margin-left: 32rpx;
					font-size: 28rpx;
					color: #151516;

					.value {
						font-size: 22rpx;
						font-weight: bold;
					}
				}
			}
		}

		.logout {
			background-color: #ffffff;
			height: 124rpx;
			box-shadow: 0px 3px 6px rgba(191, 191, 191, 0.16);
			border-radius: 16rpx;
			color: #242424;
			font-size: 32rpx;
		}
	}
</style>